#include "ClientHandle.h"

ClientHandle::ClientHandle(const qintptr id, const QString &_name, QObject *parent) : QTcpSocket(parent)
{
	// Constructor sets socket descriptor and name of client.
    if (id != -1)
        setSocketDescriptor(id);

    if (_name != "")
        m_name = _name;
}

ClientHandle &ClientHandle::operator = (const ClientHandle &c)
{
	// Copy the client's details
    if (this != &c)
    {
        m_name = c.m_name;
        setSocketDescriptor(c.getId());
    }
    return *this;
}
